package com.taozi.netty.socketio.use.classroomchat.utils;

import java.util.Random;

/**
 * 随机生成字符串 工具类
 *
 * @author mingtao
 */
public class CommonRandomUtils {

    /**
     * @description 随机生成字符串  a-z小写 + 0-9数字
     * @param length 生成字符串的长度
     * @return java.lang.String
     * @author mingtao
     * @date 19:03 2019/6/20
     **/
    public static String getRandomString(int length){
        String str = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for(int i=0; i<length; i++){
            int number = random.nextInt(36);
            sb.append(str.charAt(number));
        }
        return sb.toString();
    }



}
